﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SchEdu.Framework.DataModel;
using SchEdu.Framework.Validators;

namespace SchEdu.Framework.Objective
{
    class TotalWeighedCompletionTime : Objective
    {
        public TotalWeighedCompletionTime()
            : base()
        {
        }
        public TotalWeighedCompletionTime(SchEduData schEduData, SchEduDataSet.SolutionRow solution)
            : base(schEduData, solution)
        {
        }
        protected override void Logic()
        {
            int totalWeighedCompletionTime = 0;

            foreach (SchEduDataSet.OrderRow order in SchEduData.Order)
            {
                totalWeighedCompletionTime = totalWeighedCompletionTime + (order.Weight * order.EndDate);
            }

        }

        protected override void InitializeValidators()
        {
            base.InitializeValidators();
            validators.Add(new OrderDueDateValidator(SchEduData));
            validators.Add(new OrderWeightValidator(SchEduData));
        }

        public override AboutInfo AboutInfo
        {
            get
            {
                AboutInfo aboutInfo = new AboutInfo();
                aboutInfo.Title = "Total Weighed Completion Time";
                aboutInfo.Guid = new Guid("{9F526C25-848C-4f84-9ADD-10E2B941B4F7}");
                aboutInfo.Description = Resources.TotalWeighedCompletionTimeDescription;
                return aboutInfo;
            }
        }


    }
}
